<?php

namespace seecms\carousel;

use seecms\lib\module\ModulePublish;
use seecms\See;

class CarouselPublish extends ModulePublish
{

    protected function tableFile(): string
    {
        return dirname(__FILE__, 2) . '/database/table.sql';
    }

    protected function getMenuList(): array
    {
        $data = See::db()->table('see_menu')
            ->where('parent_id', 0)
            ->where('title', '常规管理')
            ->find();

        $parent_id = 0;
        if ($data) {
            $parent_id = $data['id'] ?? '';
        }

        return [
            $this->concatMenu($parent_id, '轮播图', 'layui-icon layui-icon-picture', 'carousel/index'),
        ];
    }

    protected function getRuleList(): array
    {
        return $this->getResourceRuleList('carousel', '轮播图');
    }
}